﻿<%@ Page Title="" Language="C#" MasterPageFile="~/MasterPage/Site.Master" AutoEventWireup="true" CodeBehind="main.aspx.cs" Inherits="BugSysSolution.main" %>
<%@ Register TagPrefix="ajaxpage" Src="~/UserControls/AjaxPaging.ascx" TagName="Paging" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
    <div>
        <table id="tab1" class="tab">
            <thead>
                <tr>
                    <td>序号</td>
                    <td>标题</td>
                    <td>内容</td>
                    <td>创建人</td>
                    <td>创建时间</td>
                </tr>
            </thead>
            <tbody id="tbody">

            </tbody>
        </table>
        <div style="border:1px solid red;width:100%;height:20px;position:relative;top:50%">
            <ajaxpage:Paging ID="ajaxpaing" runat="server" />
        </div>
    </div>
    <script type="text/javascript">
        var requestUrl = "../RequestAjaxPage/MainPageAjaxPage.aspx";
        var bugtype = '<%= Request["type"] %>';

        var p = new ajaxpaging(4, requestUrl, loaddata);
        if (bugtype == "") {
            bugtype = "0";
        }

        SendAjax("get", requestUrl, { tag: 'getbuglist', ran: Math.random(), bugtype: bugtype }, "json", function (data) {
            p.Init(data);
        });

        function loaddata(data) {
            $("#tbody tr").each(function () {
                $(this).remove();
            })
            var html = "";
            for (var i = 0; i < data.length; i++) {
                html += "<tr>";
                html += "<td>" + data[i].RN + "</td>";
                html += "<td tag='" + data[i].id + "'><a target='_blank' id='" + data[i].id + "' href='BugReplys.aspx?bugid="+data[i].id+"'>" + data[i].Title + "</a></td>";
                html += "<td title='" + data[i].Contents + "'>" + cutStr(data[i].Contents, 10) + "</td>";
                html += "<td>" + data[i].Uid + "</td>";
                html += "<td>" + ChangeDate(data[i].CreateDate) + "</td>";
                html += "</tr>";
            }
            $("#tab1").find("tbody").append($(html));
        }

        function BugClick(obj) {
            window.location.href = "BugReplys.aspx?bugid=" + $(obj).attr("id");
        }
    </script>
</asp:Content>
 